package com.smforj.ssm.sys.web.dao.impl;

import com.smforj.ssm.frame.core.dao.impl.BaseDaoImpl;
import com.smforj.ssm.frame.core.exception.DaoException;
import com.smforj.ssm.frame.core.utils.BeanUtils;
import com.smforj.ssm.sys.web.bean.SysDevice;
import com.smforj.ssm.sys.web.dao.SysDeviceDao;
import org.springframework.stereotype.Repository;

import java.util.Map;

/**
 * 
 * @author jadeshi
 * @date 2017/11/30 11:27
 * @name SysDeviceDaoImpl.java
 * @package com.smforj.ssm.sys.web.dao.impl
 **/
@Repository
public class SysDeviceDaoImpl extends BaseDaoImpl<SysDevice> implements SysDeviceDao{
    /**
     * 获取设备信息
     * @date 2017/11/30 11:39
     * @method getDevice
     * @param [query]
     * @return com.smforj.ssm.sys.web.bean.SysDevice
     **/
    @Override
    public SysDevice getDevice(SysDevice query) {
        String statement = "selectDevice";
        try {
            Map<String, Object> params = BeanUtils.toMap(query);
            return this.getSqlSessionTemplate().selectOne(getSqlName(statement), params);
        } catch (Exception e) {
            throw new DaoException(String.format("查询对象列表出错！语句：%s", getSqlName(statement)), e);
        }
    }
}
